package  
{
	import org.flixel.*;
	import mx.core.FlexSprite;
	/**
	 * ...
	 * @author Colin
	 */
	public class CCTVCamera extends FlxSprite
	{
		[Embed(source = "Resources/Camera.png")] private var CameraTexture:Class
		private var state:String;
		private var turnTime:Number;
		
		public function CCTVCamera(X:Number,Y:Number,Player:FlxSprite) 
		{
			super(X, Y);
			loadGraphic(CameraTexture, true, true, 14, 10);
			addAnimation("Idle", [0,1],2);
			addAnimation("Alert", [2]);
			play("Idle");
			state = ("idle");
			turnTime = 5;
		}
		
		override public function update():void 
		{
			super.update();
			if (state == "idle") turnTime -= 1 * FlxG.elapsed;
			if (turnTime <= 0) {
				turnTime = 5;
				if (facing == LEFT) facing = RIGHT;
				else facing = LEFT;
			}
		}
		
	}

}